package ptumall.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ptumall.dao.HotKeywordDao;

import java.util.List;

@Service
public class HotKeywordService {

    @Autowired
    private HotKeywordDao hotKeywordDao;

    public List<String> getHotKeywords(int top) {
        return hotKeywordDao.selectHotKeywords(top);
    }

    @Transactional
    public void incrementKeywordCount(String keyword) {
        hotKeywordDao.insertOrUpdateCount(keyword);
    }
}